<!-- @Author: Yu_Bo -->
<template>
	<view class="footer_main">
		<view class="footer_top" :style="[topStyle]"></view>
		<view class="footer_fixed">
			<slot></slot>
			<view class="footer_bottom" :style="[botStyle]"></view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		props: {},
		data() {
			return {
				bottomHeight: 0,
			}
		},
		computed: {
			topStyle() {
				return {
					paddingBottom: this.bottomHeight ? '20px' : '0px'
				}
			},
			botStyle() {
				return {
					height: this.bottomHeight ? '20px' : '0px'
				}
			},
		},
		mounted() {
			var that = this
			uni.getSystemInfo({
				success: function(res) {
					that.bottomHeight = res.safeAreaInsets.bottom
				}
			});
		},
		methods: {},
	}
</script>

<style lang='scss' scoped>
	.footer_top {
		width: 100%;
		padding-top: 150rpx;
	}

	.footer_fixed {
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 100;
		width: 100%;
	}
	
	.footer_bottom {
		background: #fff;
	}
</style>